<template>
	<div>
		<el-card class="!border-none pt-4 mt-[20px]" shadow="never">
			<div class="topTitle font-bold main-color text-2xl mb-5">
				基础信息
			</div>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">产品类型：</span>
						<el-radio-group v-model="radio" class="flex-1 ml-[10px]">
							<el-radio label="1" size="large">反击破产品</el-radio>
							<el-radio label="2" size="large">鄂破产品</el-radio>
							<el-radio label="3" size="large">圆锥类产品</el-radio>
						</el-radio-group>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">产品单位：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">产品编号：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">产品名称：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex v-col-top">
						<span class="w-[100px] text-right">封面图：</span>
						<el-upload class="avatar-uploader"
							action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
							:show-file-list="false" :on-success="handleAvatarSuccess"
							:before-upload="beforeAvatarUpload" :limit="1">
							<img v-if="imageUrl" :src="imageUrl" class="avatar" />
							<el-icon v-else class="avatar-uploader-icon">
								<Plus />
							</el-icon>
						</el-upload>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex v-col-top">
						<span class="w-[100px] text-right">轮播图：</span>
						<el-upload class="avatar-uploader"
							action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
							:show-file-list="false" :on-success="handleAvatarSuccess"
							:before-upload="beforeAvatarUpload" :limit="5">
							<img v-if="imageUrl" :src="imageUrl" class="avatar" />
							<el-icon v-else class="avatar-uploader-icon">
								<Plus />
							</el-icon>
						</el-upload>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">产品分类：</span>
						<el-select placeholder="下拉选择二级分类" class="flex-1 ml-[10px]">
							<el-option v-for="item in options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">型号：</span>
						<el-select placeholder="下拉选择已创建的型号" class="flex-1 ml-[10px]">
							<el-option v-for="item in options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">规格条码：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">规格编码：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">品牌：</span>
						<el-select placeholder="请选择" class="flex-1 ml-[10px]">
							<el-option v-for="item in options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">材质：</span>
						<el-select placeholder="下拉选择已创建的材质" class="flex-1 ml-[10px]">
							<el-option v-for="item in options" :key="item.value" :label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">单重：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">外形尺寸：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">产品图号：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">工厂图号：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">原装图号：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">库存：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">价格：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入">
							<template #append>
								<span class="main-color">$</span>
							</template>
						</el-input>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">排序：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="7">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">低库存预警：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
				<el-col :span="7" class="ml-[66px]">
					<div class="main-color v-flex">
						<span class="w-[100px] text-right">高库存预警：</span>
						<el-input class="flex-1 ml-[10px]" placeholder="请输入"></el-input>
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="15">
					<div class="main-color v-flex v-col-top">
						<span class="w-[100px] text-right">品牌资料：</span>
						<editor  class="flex-1 ml-[10px]" :height="667"  />
					</div>
				</el-col>
			</el-row>
			<el-row class="mt-[20px]">
				<el-col :span="15">
					<div class="main-color v-flex v-col-top">
						<span class="w-[100px] text-right">产品详情：</span>
						<editor  class="flex-1 ml-[10px]" :height="667"  />
					</div>
				</el-col>
			</el-row>
		</el-card>
		<el-row class="mt-[30px]">
			<el-button class="main-color1 w-[100px] h-[36px]" >
				<span>取消</span>
			</el-button>
			<el-button class="w-[100px] h-[36px]" color="#0054A6" type="primary">
				<span>保存</span>
			</el-button>
		</el-row>
	</div>
</template>

<script lang="ts" setup>
	import type { UploadProps } from 'element-plus'
	import { Plus } from '@element-plus/icons-vue'
	const options = ref<Array<any>>([
		{
			value: '1',
			label: 'Metos/Sandvik/Extec/Symons'
		}, 
	])
	const radio = ref('1')
	const imageUrl = ref('')//图片上传
	const handleAvatarSuccess : UploadProps['onSuccess'] = (
		response,
		uploadFile
	) => {
		imageUrl.value = URL.createObjectURL(uploadFile.raw!)
	}
	const beforeAvatarUpload : UploadProps['beforeUpload'] = (rawFile) => {
	
		return true
	}
</script>

<style scoped lang="scss">
	.avatar-uploader .avatar {
		width: 178px;
		height: 178px;
		display: block;
	}
	
	.avatar-uploader .el-upload {
		border: 1px dashed var(--el-border-color);
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
		transition: var(--el-transition-duration-fast);
	}
	
	.avatar-uploader .el-upload:hover {
		border-color: var(--el-color-primary);
	}
	
	.el-icon.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 100px;
		height: 100px;
		text-align: center;
		background: #F7F7F7;
	}
</style>